#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
using namespace std;

int GetMonthDay(int year, int month)
{
    static int MonthDay[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
    if ((month == 2) && ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
    {
        return 29;
    }
    else
    {
        return MonthDay[month];
    }
}

void Swap(int& a, int& b)
{
    int tmp1 = a;
    a = b;
    b = tmp1;
}

int main()
{
    int year1, month1, day1;
    int year2, month2, day2;
    scanf("%4d%2d%2d", &year1, &month1, &day1);
    scanf("%4d%2d%2d", &year2, &month2, &day2);

    int gapday = 0;

    if (year1 > year2)
    {
        Swap(year1, year2);
        Swap(month1, month2);
        Swap(day1, day2);
    }
    else if (year1 == year2)
    {
        if (month1 > month2)
        {
            Swap(month1, month2);
            Swap(day1, day2);
        }
        else if (month1 == month2)
        {
            if (day1 > day2)
            {
                Swap(day1, day2);
            }

            if (day1 - day2 == 1)
            {
                return 2;
            }
        }
    }


    int tmp1 = month1;


    while (year1 != year2)
    {
        gapday += (GetMonthDay(year1, tmp1) - day1 + 1);
        tmp1++;
        while (tmp1 != 13)
        {
            int day = GetMonthDay(year1, tmp1);
            gapday += day;
            tmp1++;
        }
        tmp1 = 1;
        year1++;
        if (year1 == year2)
        {
            month1 = 1;
            day1 = 1;
        }
    }


    while (month1 != month2)
    {
        int day = GetMonthDay(year1, month1);
        gapday += day;
        month1++;
    }

    gapday += (day2 - day1 + 1);

    cout << gapday << endl;

    return 0;
}